home *** CD-ROM | disk | FTP | other *** search
/ Hacker 5 / HACKER05.ISO / Sucelje.cst / 00057_Script_Media Preload < prev    next >
Text File  |  1998-03-04  |  7KB  |  201 lines

  1. -- Media Preload 
  2.  
  3. -- on prepareframe or mouseup
  4. -- load frames, members, a movie, or all frames and members, 
  5. -- if not ready, goes to the current frame - allows animated cursor or other behaviors to
  6. -- happen
  7.  
  8. property tracking   -- 0 haven't started, 1 in progress, 2 done
  9. property whichEvent
  10.  
  11. property allmembers
  12. property framerange
  13. property StartFrame
  14. property EndFrame
  15. property memberrange
  16. property StartMember
  17. property EndMember
  18. property amovie
  19. property moviename
  20. property preloadID
  21. property netaware
  22.  
  23. property gettingall       -- 0 if not started, 1 if started, 2 if finished
  24. property gettingframes
  25. property gettingmembers
  26. property gettingmovie 
  27. -- will loop on the current frame while preloading is happening
  28.  
  29. on beginsprite me
  30.   set gettingall = 0
  31.   set gettingframes = 0
  32.   set gettingmembers = 0
  33.   set gettingmovie = 0
  34. end
  35.  
  36. on init me
  37.   if tracking <> 2 then set tracking = TRUE
  38.   do_it
  39. end  
  40.  
  41. on do_it me
  42.   if tracking then
  43.     if (allmembers = TRUE and gettingall <> 2 ) and ¼
  44.        (framerange= TRUE and gettingframes <> 2 ) and ¼
  45.        (memberrange= TRUE and gettingmembers <> 2 ) and ¼
  46.        (amovie = TRUE and gettingmovie <> 2 ) then
  47.       
  48.       if netaware then
  49.         if allmembers then
  50.           if not frameready() then go the frame
  51.           if gettingall = 0 then
  52.             set gettingall = 1
  53.             preload
  54.             set gettingall = 2
  55.           end if
  56.         end if
  57.         
  58.         if framerange then
  59.           if not frameready (startframe, endframe) then go the frame
  60.           if gettingframes = 0 then
  61.             set gettingframes = 1
  62.             preload startframe, endframe
  63.             set gettingframes = 2
  64.           end if
  65.         end if
  66.         
  67.         if memberrange then
  68.           if not mediaready (startMember, endMember) then go the frame
  69.           if gettingmembers = 0 then
  70.             set gettingmembers = 1
  71.             preloadMember startMember, endMember
  72.             set gettingmembers = 2
  73.           end if        
  74.         end if
  75.         
  76.         if amovie then
  77.           if gettingmovie = 0 then
  78.             set preloadID = preloadnetthing (moviename)  -- ask Chris about this part
  79.             set gettingmovie = 1
  80.           end if
  81.           
  82.           if not netDone(preloadID) then go the frame  --netdoneID
  83.           
  84.           preLoadMovie moviename
  85.           set gettingmovie = 2
  86.           
  87.         end if
  88.       else -- end netaware
  89.         if allmembers then    
  90.           if gettingall = 0 then
  91.             set gettingall = 1
  92.             preload
  93.             set gettingall = 2
  94.           end if
  95.         end if
  96.         
  97.         if framerange then
  98.           if gettingframes = 0 then
  99.             set gettingframes = 1
  100.             preload startframe, endframe
  101.             set gettingframes = 2
  102.           end if
  103.         end if
  104.         
  105.         if memberrange then
  106.           if gettingmembers = 0 then
  107.             set gettingmembers = 1
  108.             preloadMember startMember, endMember
  109.             set gettingmembers = 2
  110.           end if        
  111.         end if
  112.         
  113.         if amovie then
  114.           if gettingmovie = 0 then
  115.             set gettingmovie = 1        
  116.             preLoadMovie moviename
  117.             set gettingmovie = 2          
  118.           end if
  119.         end if 
  120.         
  121.       end if -- end not netaware   
  122.       
  123.     else -- check for everything done
  124.       set tracking = 2
  125.     end if
  126.     
  127.   end if  -- end tracking
  128.   
  129. end
  130.  
  131.  
  132. on initPreLoad me
  133.   init me
  134. end
  135.  
  136. on mouseUp me
  137.   if whichEvent = #mouseup    then init me
  138. end
  139.  
  140. on prepareFrame me
  141.   if whichEvent = #prepareframe then init me
  142. end
  143.  
  144.  
  145.  
  146. ---
  147.  
  148. on getPropertyDescriptionList
  149.   
  150.   set p_list = [ ¼
  151.     #whichEvent: [ #comment:   "Initializing Event:", ¼
  152.                     #format:   #symbol, ¼
  153.                      #range: [ #MouseUp, #MouseDown, #PrepareFrame,#EnterFrame, #ExitFrame], ¼
  154.                    #default:   #MouseUp ],¼
  155.      #allmembers: [ #comment:  "All Members:", ¼
  156.                     #format:   #boolean, ¼
  157.                    #default:    0 ], ¼
  158.    #framerange:  [ #comment:   "Frame Range:", ¼
  159.                     #format:   #boolean, ¼
  160.                    #default:    0 ], ¼
  161.     #StartFrame: [ #comment:   "Start Frame:", ¼
  162.                     #format:   #integer, ¼
  163.                    #default:   0 ], ¼
  164.       #EndFrame: [ #comment:   "End Frame:", ¼
  165.                     #format:   #integer, ¼
  166.                    #default:   0 ], ¼
  167.  #memberrange:   [ #comment:   "Member Range:", ¼
  168.                     #format:   #boolean, ¼
  169.                    #default:    0 ], ¼
  170.     #StartMember: [ #comment:   "Start Member:", ¼
  171.                     #format:   #member, ¼
  172.                    #default:   member 1 ], ¼
  173.       #EndMember: [ #comment:   "End Member:", ¼
  174.                     #format:   #member, ¼
  175.                    #default:   member 1 ], ¼
  176.         #amovie: [ #comment:   "Preload Movie:", ¼
  177.                     #format:   #boolean, ¼
  178.                    #default:    0 ], ¼
  179.      #moviename: [ #comment:   "Movie Name:", ¼
  180.                     #format:   #string, ¼
  181.                    #default:   "" ], ¼
  182.       #netaware: [ #comment:   "Internet Aware:", ¼
  183.                     #format:   #boolean, ¼
  184.                    #default:    0 ] ¼
  185.   ]
  186.   return p_list  
  187.   
  188. end
  189.  
  190. on getBehaviorDescription
  191.   return ¼
  192. "Loads cast members into RAM so they are instantly available to the movie. Define what to preload by specifying a range of cast members in a cast or frames in the score. The behavior can also load all the cast members in a different movie. If the Internet Aware parameter is turned on, the behavior checks the network cache to make sure the media is on the local disk before it is loaded into RAM.  "& RETURN & ¼
  193. "PARAMETERS:" & RETURN & ¼
  194. "ò Initializing Event - Specify the event that triggers the behavior. & RETURN & ¼
  195. "ò All Members - Choose this option to load all cast members in the current movie starting at the current frame."  & RETURN & ¼
  196. "ò Frame Range - Turn this option on and define a range of frames to load. Enter the start and end frames of the range in the appropriate boxes."  & RETURN & ¼
  197. "ò Member Range  - Turn this option on and define a range of cast members within a cast. Choose the first and last cast members to load from the pop-ups."  & RETURN & ¼
  198. "ò Preload Movie - Turn this option on and enter the name of a Director movie in Movie Name. All the cast members in the movie are loaded. Use this parameter to reduce delays when switching to a different movie." & RETURN & ¼
  199. "ò Internet Aware - Turn this option on to make Director check the network cache to make sure the media is on the local disk before preloading." 
  200. end
  201.